<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>ConcurrentUtils (Apache Commons Lang 3.3.2 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="ConcurrentUtils (Apache Commons Lang 3.3.2 API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ConcurrentUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/lang3/concurrent/ConstantInitializer.html" title="class in org.apache.commons.lang3.concurrent"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/lang3/concurrent/ConcurrentUtils.html" target="_top">Frames</a></li>
<li><a href="ConcurrentUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.lang3.concurrent</div>
<h2 title="Class ConcurrentUtils" class="title">Class ConcurrentUtils</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.lang3.concurrent.ConcurrentUtils</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">ConcurrentUtils</span>
extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block"><p>
 An utility class providing functionality related to the <code>java.util.concurrent</code> package.
 </p></div>
<dl><dt><span class="strong">Since:</span></dt>
  <dd>3.0</dd>
<dt><span class="strong">Version:</span></dt>
  <dd>$Id: ConcurrentUtils.java 1583482 2014-03-31 22:54:57Z niallp $</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</a>&lt;T&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#constantFuture(T)">constantFuture</a></strong>(T&nbsp;value)</code>
<div class="block">
 Gets an implementation of <code>Future</code> that is immediately done
 and returns the specified constant value.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;K,V&gt;&nbsp;V</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#createIfAbsent(java.util.concurrent.ConcurrentMap, K, org.apache.commons.lang3.concurrent.ConcurrentInitializer)">createIfAbsent</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentMap.html?is-external=true" title="class or interface in java.util.concurrent">ConcurrentMap</a>&lt;K,V&gt;&nbsp;map,
              K&nbsp;key,
              <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent">ConcurrentInitializer</a>&lt;V&gt;&nbsp;init)</code>
<div class="block">Checks if a concurrent map contains a key and creates a corresponding
 value if not.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;K,V&gt;&nbsp;V</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#createIfAbsentUnchecked(java.util.concurrent.ConcurrentMap, K, org.apache.commons.lang3.concurrent.ConcurrentInitializer)">createIfAbsentUnchecked</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentMap.html?is-external=true" title="class or interface in java.util.concurrent">ConcurrentMap</a>&lt;K,V&gt;&nbsp;map,
                       K&nbsp;key,
                       <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent">ConcurrentInitializer</a>&lt;V&gt;&nbsp;init)</code>
<div class="block">Checks if a concurrent map contains a key and creates a corresponding
 value if not, suppressing checked exceptions.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentException</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#extractCause(java.util.concurrent.ExecutionException)">extractCause</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutionException.html?is-external=true" title="class or interface in java.util.concurrent">ExecutionException</a>&nbsp;ex)</code>
<div class="block">Inspects the cause of the specified <code>ExecutionException</code> and
 creates a <code>ConcurrentException</code> with the checked cause if
 necessary.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentRuntimeException</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#extractCauseUnchecked(java.util.concurrent.ExecutionException)">extractCauseUnchecked</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutionException.html?is-external=true" title="class or interface in java.util.concurrent">ExecutionException</a>&nbsp;ex)</code>
<div class="block">Inspects the cause of the specified <code>ExecutionException</code> and
 creates a <code>ConcurrentRuntimeException</code> with the checked cause if
 necessary.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#handleCause(java.util.concurrent.ExecutionException)">handleCause</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutionException.html?is-external=true" title="class or interface in java.util.concurrent">ExecutionException</a>&nbsp;ex)</code>
<div class="block">Handles the specified <code>ExecutionException</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#handleCauseUnchecked(java.util.concurrent.ExecutionException)">handleCauseUnchecked</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutionException.html?is-external=true" title="class or interface in java.util.concurrent">ExecutionException</a>&nbsp;ex)</code>
<div class="block">Handles the specified <code>ExecutionException</code> and transforms it into a
 runtime exception.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#initialize(org.apache.commons.lang3.concurrent.ConcurrentInitializer)">initialize</a></strong>(<a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent">ConcurrentInitializer</a>&lt;T&gt;&nbsp;initializer)</code>
<div class="block">Invokes the specified <code>ConcurrentInitializer</code> and returns the
 object produced by the initializer.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#initializeUnchecked(org.apache.commons.lang3.concurrent.ConcurrentInitializer)">initializeUnchecked</a></strong>(<a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent">ConcurrentInitializer</a>&lt;T&gt;&nbsp;initializer)</code>
<div class="block">Invokes the specified <code>ConcurrentInitializer</code> and transforms
 occurring exceptions to runtime exceptions.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;K,V&gt;&nbsp;V</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#putIfAbsent(java.util.concurrent.ConcurrentMap, K, V)">putIfAbsent</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentMap.html?is-external=true" title="class or interface in java.util.concurrent">ConcurrentMap</a>&lt;K,V&gt;&nbsp;map,
           K&nbsp;key,
           V&nbsp;value)</code>
<div class="block">
 Puts a value in the specified <code>ConcurrentMap</code> if the key is not yet
 present.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="extractCause(java.util.concurrent.ExecutionException)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>extractCause</h4>
<pre>public static&nbsp;<a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentException</a>&nbsp;extractCause(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutionException.html?is-external=true" title="class or interface in java.util.concurrent">ExecutionException</a>&nbsp;ex)</pre>
<div class="block">Inspects the cause of the specified <code>ExecutionException</code> and
 creates a <code>ConcurrentException</code> with the checked cause if
 necessary. This method performs the following checks on the cause of the
 passed in exception:
 <ul>
 <li>If the passed in exception is <b>null</b> or the cause is
 <b>null</b>, this method returns <b>null</b>.</li>
 <li>If the cause is a runtime exception, it is directly thrown.</li>
 <li>If the cause is an error, it is directly thrown, too.</li>
 <li>In any other case the cause is a checked exception. The method then
 creates a <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent"><code>ConcurrentException</code></a>, initializes it with the cause, and
 returns it.</li>
 </ul></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>ex</code> - the exception to be processed</dd>
<dt><span class="strong">Returns:</span></dt><dd>a <code>ConcurrentException</code> with the checked cause</dd></dl>
</li>
</ul>
<a name="extractCauseUnchecked(java.util.concurrent.ExecutionException)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>extractCauseUnchecked</h4>
<pre>public static&nbsp;<a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentRuntimeException</a>&nbsp;extractCauseUnchecked(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutionException.html?is-external=true" title="class or interface in java.util.concurrent">ExecutionException</a>&nbsp;ex)</pre>
<div class="block">Inspects the cause of the specified <code>ExecutionException</code> and
 creates a <code>ConcurrentRuntimeException</code> with the checked cause if
 necessary. This method works exactly like
 <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#extractCause(java.util.concurrent.ExecutionException)"><code>extractCause(ExecutionException)</code></a>. The only difference is that
 the cause of the specified <code>ExecutionException</code> is extracted as a
 runtime exception. This is an alternative for client code that does not
 want to deal with checked exceptions.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>ex</code> - the exception to be processed</dd>
<dt><span class="strong">Returns:</span></dt><dd>a <code>ConcurrentRuntimeException</code> with the checked cause</dd></dl>
</li>
</ul>
<a name="handleCause(java.util.concurrent.ExecutionException)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>handleCause</h4>
<pre>public static&nbsp;void&nbsp;handleCause(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutionException.html?is-external=true" title="class or interface in java.util.concurrent">ExecutionException</a>&nbsp;ex)
                        throws <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentException</a></pre>
<div class="block">Handles the specified <code>ExecutionException</code>. This method calls
 <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#extractCause(java.util.concurrent.ExecutionException)"><code>extractCause(ExecutionException)</code></a> for obtaining the cause of the
 exception - which might already cause an unchecked exception or an error
 being thrown. If the cause is a checked exception however, it is wrapped
 in a <code>ConcurrentException</code>, which is thrown. If the passed in
 exception is <b>null</b> or has no cause, the method simply returns
 without throwing an exception.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>ex</code> - the exception to be handled</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentException</a></code> - if the cause of the <code>ExecutionException</code> is a checked exception</dd></dl>
</li>
</ul>
<a name="handleCauseUnchecked(java.util.concurrent.ExecutionException)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>handleCauseUnchecked</h4>
<pre>public static&nbsp;void&nbsp;handleCauseUnchecked(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutionException.html?is-external=true" title="class or interface in java.util.concurrent">ExecutionException</a>&nbsp;ex)</pre>
<div class="block">Handles the specified <code>ExecutionException</code> and transforms it into a
 runtime exception. This method works exactly like
 <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#handleCause(java.util.concurrent.ExecutionException)"><code>handleCause(ExecutionException)</code></a>, but instead of a
 <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent"><code>ConcurrentException</code></a> it throws a
 <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent"><code>ConcurrentRuntimeException</code></a>. This is an alternative for client
 code that does not want to deal with checked exceptions.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>ex</code> - the exception to be handled</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentRuntimeException</a></code> - if the cause of the <code>ExecutionException</code> is a checked exception; this exception is then
 wrapped in the thrown runtime exception</dd></dl>
</li>
</ul>
<a name="initialize(org.apache.commons.lang3.concurrent.ConcurrentInitializer)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initialize</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;initialize(<a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent">ConcurrentInitializer</a>&lt;T&gt;&nbsp;initializer)
                    throws <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentException</a></pre>
<div class="block">Invokes the specified <code>ConcurrentInitializer</code> and returns the
 object produced by the initializer. This method just invokes the <code>get()</code> method of the given <code>ConcurrentInitializer</code>. It is
 <b>null</b>-safe: if the argument is <b>null</b>, result is also
 <b>null</b>.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the type of the object produced by the initializer</dd><dt><span class="strong">Parameters:</span></dt><dd><code>initializer</code> - the <code>ConcurrentInitializer</code> to be invoked</dd>
<dt><span class="strong">Returns:</span></dt><dd>the object managed by the <code>ConcurrentInitializer</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentException</a></code> - if the <code>ConcurrentInitializer</code> throws
 an exception</dd></dl>
</li>
</ul>
<a name="initializeUnchecked(org.apache.commons.lang3.concurrent.ConcurrentInitializer)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initializeUnchecked</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;initializeUnchecked(<a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent">ConcurrentInitializer</a>&lt;T&gt;&nbsp;initializer)</pre>
<div class="block">Invokes the specified <code>ConcurrentInitializer</code> and transforms
 occurring exceptions to runtime exceptions. This method works like
 <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#initialize(org.apache.commons.lang3.concurrent.ConcurrentInitializer)"><code>initialize(ConcurrentInitializer)</code></a>, but if the <code>ConcurrentInitializer</code> throws a <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent"><code>ConcurrentException</code></a>, it is
 caught, and the cause is wrapped in a <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent"><code>ConcurrentRuntimeException</code></a>.
 So client code does not have to deal with checked exceptions.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the type of the object produced by the initializer</dd><dt><span class="strong">Parameters:</span></dt><dd><code>initializer</code> - the <code>ConcurrentInitializer</code> to be invoked</dd>
<dt><span class="strong">Returns:</span></dt><dd>the object managed by the <code>ConcurrentInitializer</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentRuntimeException</a></code> - if the initializer throws an exception</dd></dl>
</li>
</ul>
<a name="putIfAbsent(java.util.concurrent.ConcurrentMap,java.lang.Object,java.lang.Object)">
<!--   -->
</a><a name="putIfAbsent(java.util.concurrent.ConcurrentMap, K, V)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putIfAbsent</h4>
<pre>public static&nbsp;&lt;K,V&gt;&nbsp;V&nbsp;putIfAbsent(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentMap.html?is-external=true" title="class or interface in java.util.concurrent">ConcurrentMap</a>&lt;K,V&gt;&nbsp;map,
                  K&nbsp;key,
                  V&nbsp;value)</pre>
<div class="block"><p>
 Puts a value in the specified <code>ConcurrentMap</code> if the key is not yet
 present. This method works similar to the <code>putIfAbsent()</code> method of
 the <code>ConcurrentMap</code> interface, but the value returned is different.
 Basically, this method is equivalent to the following code fragment:
 </p>

 <pre>
 if (!map.containsKey(key)) {
     map.put(key, value);
     return value;
 } else {
     return map.get(key);
 }
 </pre>

 <p>
 except that the action is performed atomically. So this method always
 returns the value which is stored in the map.
 </p>
 <p>
 This method is <b>null</b>-safe: It accepts a <b>null</b> map as input
 without throwing an exception. In this case the return value is
 <b>null</b>, too.
 </p></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>K</code> - the type of the keys of the map</dd><dd><code>V</code> - the type of the values of the map</dd><dt><span class="strong">Parameters:</span></dt><dd><code>map</code> - the map to be modified</dd><dd><code>key</code> - the key of the value to be added</dd><dd><code>value</code> - the value to be added</dd>
<dt><span class="strong">Returns:</span></dt><dd>the value stored in the map after this operation</dd></dl>
</li>
</ul>
<a name="createIfAbsent(java.util.concurrent.ConcurrentMap,java.lang.Object,org.apache.commons.lang3.concurrent.ConcurrentInitializer)">
<!--   -->
</a><a name="createIfAbsent(java.util.concurrent.ConcurrentMap, K, org.apache.commons.lang3.concurrent.ConcurrentInitializer)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createIfAbsent</h4>
<pre>public static&nbsp;&lt;K,V&gt;&nbsp;V&nbsp;createIfAbsent(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentMap.html?is-external=true" title="class or interface in java.util.concurrent">ConcurrentMap</a>&lt;K,V&gt;&nbsp;map,
                     K&nbsp;key,
                     <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent">ConcurrentInitializer</a>&lt;V&gt;&nbsp;init)
                        throws <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentException</a></pre>
<div class="block">Checks if a concurrent map contains a key and creates a corresponding
 value if not. This method first checks the presence of the key in the
 given map. If it is already contained, its value is returned. Otherwise
 the <code>get()</code> method of the passed in <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent"><code>ConcurrentInitializer</code></a>
 is called. With the resulting object
 <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentUtils.html#putIfAbsent(java.util.concurrent.ConcurrentMap, K, V)"><code>putIfAbsent(ConcurrentMap, Object, Object)</code></a> is called. This
 handles the case that in the meantime another thread has added the key to
 the map. Both the map and the initializer can be <b>null</b>; in this
 case this method simply returns <b>null</b>.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>K</code> - the type of the keys of the map</dd><dd><code>V</code> - the type of the values of the map</dd><dt><span class="strong">Parameters:</span></dt><dd><code>map</code> - the map to be modified</dd><dd><code>key</code> - the key of the value to be added</dd><dd><code>init</code> - the <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent"><code>ConcurrentInitializer</code></a> for creating the value</dd>
<dt><span class="strong">Returns:</span></dt><dd>the value stored in the map after this operation; this may or may
 not be the object created by the <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent"><code>ConcurrentInitializer</code></a></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentException</a></code> - if the initializer throws an exception</dd></dl>
</li>
</ul>
<a name="createIfAbsentUnchecked(java.util.concurrent.ConcurrentMap,java.lang.Object,org.apache.commons.lang3.concurrent.ConcurrentInitializer)">
<!--   -->
</a><a name="createIfAbsentUnchecked(java.util.concurrent.ConcurrentMap, K, org.apache.commons.lang3.concurrent.ConcurrentInitializer)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createIfAbsentUnchecked</h4>
<pre>public static&nbsp;&lt;K,V&gt;&nbsp;V&nbsp;createIfAbsentUnchecked(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentMap.html?is-external=true" title="class or interface in java.util.concurrent">ConcurrentMap</a>&lt;K,V&gt;&nbsp;map,
                              K&nbsp;key,
                              <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent">ConcurrentInitializer</a>&lt;V&gt;&nbsp;init)</pre>
<div class="block">Checks if a concurrent map contains a key and creates a corresponding
 value if not, suppressing checked exceptions. This method calls
 <code>createIfAbsent()</code>. If a <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentException.html" title="class in org.apache.commons.lang3.concurrent"><code>ConcurrentException</code></a> is thrown, it
 is caught and re-thrown as a <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent"><code>ConcurrentRuntimeException</code></a>.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>K</code> - the type of the keys of the map</dd><dd><code>V</code> - the type of the values of the map</dd><dt><span class="strong">Parameters:</span></dt><dd><code>map</code> - the map to be modified</dd><dd><code>key</code> - the key of the value to be added</dd><dd><code>init</code> - the <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent"><code>ConcurrentInitializer</code></a> for creating the value</dd>
<dt><span class="strong">Returns:</span></dt><dd>the value stored in the map after this operation; this may or may
 not be the object created by the <a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentInitializer.html" title="interface in org.apache.commons.lang3.concurrent"><code>ConcurrentInitializer</code></a></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent">ConcurrentRuntimeException</a></code> - if the initializer throws an exception</dd></dl>
</li>
</ul>
<a name="constantFuture(java.lang.Object)">
<!--   -->
</a><a name="constantFuture(T)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>constantFuture</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</a>&lt;T&gt;&nbsp;constantFuture(T&nbsp;value)</pre>
<div class="block"><p>
 Gets an implementation of <code>Future</code> that is immediately done
 and returns the specified constant value.
 </p>
 <p>
 This can be useful to return a simple constant immediately from the
 concurrent processing, perhaps as part of avoiding nulls.
 A constant future can also be useful in testing.
 </p></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the type of the value used by this <code>Future</code> object</dd><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - the constant value to return, may be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>an instance of Future that will return the value, never null</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ConcurrentUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/lang3/concurrent/ConcurrentRuntimeException.html" title="class in org.apache.commons.lang3.concurrent"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/lang3/concurrent/ConstantInitializer.html" title="class in org.apache.commons.lang3.concurrent"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/lang3/concurrent/ConcurrentUtils.html" target="_top">Frames</a></li>
<li><a href="ConcurrentUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2001&#x2013;2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
